<?php
	class DskPage extends Page{
		
		var $jst;
		
		// Whether to build with chrome wrappers
		var $chrome_wrappers = true;
		
		var $links = array(
			array('icon', 'image/png', '/@public/smuoicon.png')
		);
		
		// APP-specific css
		function css_include($filename, $path=false){
			$this->add_css(APP()->file_uri($filename, '/css', $path));	
		}
		
		function build(){
			$this->title = APP()->title();
			parent::build();
		}
		
		function js(){
			if(is_null($this->jst)) $this->jst = new JsTagger;
			return $this->jst;
		}
		
		function jsln($s){
			$this->js()->ln($s);
		}
		
		function write_js(){
			$App = App();
			if(isset($App->toolbar) && $App->toolbar) $this->js()->ln('Chrome.tlb = '.Toolbar()->to_js());
			parent::write_js();
		}
	
		function write_body(){
			if($this->chrome_wrappers) $this->start_body();
			$this->obln($this->bd);
			if($this->chrome_wrappers) $this->end_body();
		}

		// With chrome header and footer
		function start_body(){
			$this->obln('<div id="wrp" align="center">'
				. '<div id="logoTop">'
				. '<div style="background-image:url('.APP()->icon().')" id="icontop"></div>'
				. '</div>'
				. '<div id="head">'
				. '<div id="headInner">'
				. '<div id="headBar">'
				. '<div id="headNav"><a href="http://'.DOM_NAME.'" target="_blank">http://'.DOM_NAME.'</a> '
				. '&nbsp;|&nbsp; <a class="help" href="javascript:justsay(\'not yet! :)\')">Help</a> '
				. '&nbsp;|&nbsp; <a href="/?logout">Sign Out</a></div>'
				. '<div id="headTit"><strong>'.APP()->title().'</strong></div>'
				. '</div>'
				. '<div id="headstrap">'
				. '<div id="headloc">'.APP()->build_nav_element().'</div>'
				. '</div>'
				. '</div>'
				. '</div>'
				. '<div id="cnt">'
				. '<div id="wait" style="display:none"></div>'
				. '<div id="tlb"></div><div id="tlbx"></div>'
			);
		}
		
		function mkbody($sidebar='', $maincell=''){
			$str = '<div id="main"><table id="maintable" border="0" cellpadding="0" cellspacing="0" width="100%">'."\n\t<tbody>\n\t\t<tr>\n";
			if($sidebar) $str .= $this->sidebar($sidebar);
			$str .= $this->maincell($maincell);
			$str .= "\t\t</tr>\n\t</tbody>\n</table></div>";
			$this->ln($str);
		}
		
		function sidebar($str=''){
			return "\t\t\t<td id=\"leftcell\" valign=\"top\"><div id=\"sidebar\">\n\t\t\t$str\n\t\t\t</div></td>\n";
		}
		
		function maincell($str=''){
			return "\t\t\t<td id=\"maincell\" valign=\"top\">\n\t\t\t$str\n\t\t\t</td>\n";
		}
		
		function end_body(){
			$this->obln('</div>'
				. '</div>'
				. '<div id="ft"><small>' . '&nbsp;&nbsp;</small></div>'
				. '<div id="msk" style="display:none"></div><div id="upng"></div>'
				. '<div id="upbg"></div><div id="spkbk" style="display:none;width:0px;height:0px"></div>'
				. '<div id="spk" style="display:none"></div>'
			);
		}
	}


